<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	
	<script type="text/javascript" src="<%=path%>/ajax/engine.js"></script>
	<script type="text/javascript" src="<%=path%>/ajax/util.js"></script>
	<script type="text/javascript" src="<%=path%>/ajax/interface/NoticeAjaxController.js"></script>
	
	<script type="text/javascript">
	
	
	function getNumber()
	{

		NoticeAjaxController.getNoticeNumber({callback:function(dataFromServer){
			//alert(dataFromServer);
			document.getElementById("number").innerHTML=dataFromServer;
	} 
	}); 
	}
	
	var addNoticeHandler = function(dataFromServer){
			//alert(dataFromServer);
			document.forms.notice.title1.value=dataFromServer.title;
			document.forms.notice.isstudio1.value=dataFromServer.isstudio;
			document.forms.notice.content1.value=dataFromServer.content;
	} 
	
	function addNotice()
	{

		var notice={title:null,
					isstudio:null,
					content:null};
		dwr.util.getValues(notice);
	
		NoticeAjaxController.addNoticeAjax(notice,addNoticeHandler); 
	}
	</script>
	
  </head>
  
  <body>
  <div>
	   	Simple Ajax Test<input type="button" onclick="getNumber();" value="Get Notice Number" />
	   	number: <span id="number"></span>
  </div>
  <hr />
  <div>
	   	Complex Ajax Test
	   
		  	title:<input type="text" id="title" />
		  	isstudio:<input type="checkbox" id="isstudioBox" onchange="document.getElementById('isstudio').value=this.value?'Y':'N'" /><input type="hidden" id="isstudio" value="N" />
		  	content:<input type="text" id="content" />		  	
	
		<input type="button" onclick="addNotice();" value="Add Notice" />
	   	<div>
	   	New Notice is:
	   	<form name="notice">
		  	title:<input type="text" name="title1" />
		  	isstudio:<input type="text" name="isstudio1" />
		  	content:<input type="text" name="content1" />
		</form>
	   	</div>
  </div>
  <hr />
   
  <div>
	  <span>Spring Test</span>
	  <form action="/RoseParadise/action/notice.htm?cmd=add" method="post">
	  	<input type="text" name="title">
	  	<input type="submit" value="add notice"/>
	  </form>
  </div>
  <hr />
  <a href="/RoseParadise/action/MainHome.htm?cmd=show" >MainHome</a>
  </body>
</html>
